<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">

    <script type='text/html' template lay-done='layui.data.formdone(d.params);'>
        <input type='hidden' name='PID' value="{{ d.params.PID || '' }}" />
    </script>

    <div class='layui-form-item'>
        <label class='layui-form-label'>联系人<span style="color:red">*</span></label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='UserName' value='{{ d.params.UserName || '' }}' lay-verify='required' placeholder='联系人' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>
    <div class='layui-form-item'>
        <label class='layui-form-label'>联系电话<span style="color:red">*</span></label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='UserTel' value='{{ d.params.UserTel || '' }}' lay-verify='required' placeholder='联系电话' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>
    <div class='layui-form-item'>
        <label class='layui-form-label'>省市区<span style="color:red">*</span></label>
        <div class='layui-input-inline' style="width:120px">
            <input type='text' name='province' id="province" lay-verify='required' placeholder='省' autocomplete='off' class='layui-input'>
        </div>
        <div class='layui-input-inline' style="width:120px">
            <input type='text' name='city' id="city" lay-verify='required' placeholder='市' autocomplete='off' class='layui-input'>
        </div>
        <div class='layui-input-inline' style="width:120px">
            <input type='text' name='area' id="area" lay-verify='required' placeholder='区' autocomplete='off' class='layui-input'>
        </div>
    </div>
    <div class='layui-form-item'>
        <label class='layui-form-label'>街道</label>
        <div class='layui-input-inline' style="width:380px">
            <script type='text/html' template>
                <input type='text' name='street' id="street" placeholder='街道' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>
    <div class='layui-form-item'>
        <label class='layui-form-label'>详细地址<span style="color:red">*</span></label>
        <div class='layui-input-inline' style="width:380px">
            <script type='text/html' template>
                <input type='text' name='address' id="address" lay-verify='required' placeholder='详细地址' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-inline">
            <input type="button" lay-submit lay-filter="layuiadmin-app-form-submit" value="确认" class="layui-btn">
        </div>
    </div>
</div>

<script type="text/javascript">

    layui.use(['form', 'admin', 'laydate'], function () {
        var form = layui.form;//required（必填项）phone（手机号）email（邮箱）url（网址）number（数字）date（日期）identity（身份证） 自定义值
    });


    layui.data.formdone = function (d) {
        var $ = layui.$;
        var form = layui.form;
        var admin = layui.admin;

        if (d.UserAddress != "" && d.UserAddress != null) {
            //debugger;
            var ads = d.UserAddress.split(" ");
            var province = "";
            var city = "";
            var area = "";
            var street = "";
            var address = "";

            if (ads.length <= 4) {
                province = ads[0];
                city = ads[1];
                area = ads[2];
                address = ads[3];
            } else {
                province = ads[0];
                city = ads[1];
                area = ads[2];
                street = ads[3];
                address = ads[4];
            }

            $("#province").val(province);
            $("#city").val(city);
            $("#area").val(area); 
            $("#street").val(street);
            $("#address").val(address);
        }
    }

</script>
